package cn.czh.inventory.controller;

import cn.czh.inventory.common.web.JsonResult;
import cn.czh.inventory.pojo.param.PurchaseOrdersParam;
import cn.czh.inventory.service.IPurchaseService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/purch")
@RestController
@Slf4j
@Api(tags="采购开单")
public class PuchaseController {
    @Autowired
    private IPurchaseService purchaseService;

    /**
     * 新增订单
     * @param purchaseOrdersParam 采购订单
     */
    @ApiOperation("新增采购订单")
    @PostMapping("/add")
    public JsonResult addPurchaseOrder(@Validated @RequestBody PurchaseOrdersParam purchaseOrdersParam){
        purchaseService.addPurchaseOrder(purchaseOrdersParam);
        log.debug("新增采购订单入参:{},出参:{}",purchaseOrdersParam,JsonResult.ok());

        return JsonResult.ok();
    }
}
